<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<table border="1">
  <caption>商品列表</caption>
  <tr>
    <th>id</th>
    <th>标题</th>
    <th>价格</th>
    <th>库存</th>
  </tr>
  <tr v-for="p in arr">
    <td>{{p.id}}</td>
    <td>{{p.title}}</td>
    <td>{{p.price}}</td>
    <td>{{p.num}}</td>
  </tr>
</table>
<script src="https://cdn.bootcdn.net/ajax/libs/axios/0.21.1/axios.min.js"></script>
<script src="https://cdn.staticfile.org/vue/2.2.2/vue.min.js"></script>
<script>
  let v = new Vue({
    el:"table",
    data:{
      arr:[]
    },
    methods: {
    },
    created:function () {
      //发请求获取商品数组    localhost:8080/select
      axios.get("/select").then(function (response) {
        v.arr = response.data;
      })
    }
  })
</script>
</body>
</html>




